Check to make sure you don't already have a SSH key pair.
- They will probably be in
~/.ssh on Linux, and C:/Users/<username>/.ssh on Windows.
- They'll look something like
id_ed25519 (the private key), and id_ed25519.pub (the public key):
- ![[Pasted image 20260812114858.png]]
- If you don't have any SSH keys here, generate them with
ssh-keygen -t ed25519 -a 100. Afterwards, the keys should appear.
Tell the server about the key
- Go to your git hosting provider, and follow their instructions to add the contents of the public key.
- for git.gay, it looks like this:
- Go to https://git.gay/user/settings/keys
- "Add Key"
- Name the key after the device it will be used from
- Paste the contents of the
Public Key in "Content" and confirm.
- You can then verify the key by providing the contents of the private key.
- Next, you must tell set up your local machine to use the keys.
- Add the Private key
ssh-add /path/to/private/key
- In your terminal, run the following commands:
- Make git use SSH to sign commits and tags:
git config set --global gpg.format ssh
- Set the SSH signing key to your public key:
git config set --global user.signingKey '/path/to/public/key.pub'
- Sign commits by default:
git config set --global commit.gpgSign true
Update local repositories to use the key
- Finally, if the git repo was not set up with the key from the start, you will need to update it to use the key (I guess????)
cd /path/to/repo
- `git remote -v
- If the URL starts with
https://, you will need to change it to the SSH format. To do this, use the following command, replacing username and repository with your GitHub username and repository name:
git remote set-url origin git@YourHostingProvider.com:username/repository.git
- Verify it updated:
git remote -v
In theory, it should now work!
I hate this
Sources: